
import React,{Component} from 'react'
// eslint-disable-next-line
import { Form, Input, Button, Checkbox } from 'antd';
import {Link} from 'react-router-dom'
import '../../../../static/css/login.less'

// const item = Form.Item


const layout = {
    labelCol: {
        span: 8,
    },
    wrapperCol: {
        span: 16,
    },
};
const tailLayout = {
    wrapperCol: {
        offset: 8,
        span: 16,
    },
};

class regist extends Component{
    constructor(props) {
        super(props);
        this.state ={
            username:'',
            password:''
        }
        this.handleClick = this.handleClick.bind(this)
    }
    handleClick(){
        this.props.history.push('/login')
    }


    onFinish(values){
        console.log('Success:', values);
        console.log('register',values.username,values.password)
    }

    onFinishFailed(errorInfo){
        console.log('Failed:', errorInfo);
    }


    render() {

        return (
            <>
            <div className="goback">
                <Link to="/index">返回主页</Link>
            </div>
            <div className="loginform">
                <Form
                    {...layout}
                    name="basic"
                    initialValues={{
                        remember: true,
                    }}
                    onFinish={this.onFinish}
                    onFinishFailed={this.onFinishFailed}
                >
                    <Form.Item
                        label="用户名"
                        name="username"
                        rules={[
                            {
                                required: true,
                                message: '请输入用户名!',
                            },
                        ]}
                    >
                        <Input />
                    </Form.Item>

                    <Form.Item
                        label="密码"
                        name="password"
                        rules={[
                            {
                                required: true,
                                message: '请输入密码!',
                            },
                        ]}
                    >
                        <Input.Password />
                    </Form.Item>

                    {/*<Form.Item {...tailLayout} name="remember" valuePropName="checked">*/}
                    {/*    <Checkbox>Remember me</Checkbox>*/}
                    {/*</Form.Item>*/}

                    <Form.Item {...tailLayout}>
                        <Button type="primary" htmlType="submit" >
                            注册
                        </Button>
                        <Button type="primary" style={{marginLeft:'20px'}} onClick={this.handleClick}>
                            返回登录
                        </Button>
                    </Form.Item>
                </Form>
            </div>
            </>
        )
    }

}


const wrapRegist = regist
export default wrapRegist
